Repository navigation
Public projections: allowlisted operational fields, proven with fast-check - #85
Conversation
…en with fast-check Plan item 20. An operational record used to carry every field its source held (`[key: string]: any`), guarded only by a denylist. Now: - PUBLIC_OPERATIONAL_RECORD_FIELDS lists each collection's top-level public fields, matching the content.public_* views and the committed snapshot - the snapshot keeps only those fields, after the quarantine check (so its alerts still fire) and in the record's own key order - the record types name their fields; an unlisted one does not type-check - scripts/public-projection-allowlist.test.ts proves with fast-check that extra and private fields (known names and random ones, at any depth) never reach operational records, map nodes, map state nodes or the impact payload, and that unapproved submissions are never published - fast-check 4.10.3 added as an exact devDependency (approved by afo) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Model: claude-opus-5-5/high
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 2 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…ecords The fast-check properties found private values that the operational scan let through when nested inside a published object: media.request_metadata, featuredStory.request_ip, media.consumed_at, impactSources.mediaUrls, cadence.works. The scan now also matches, exactly, the private names the map node and impact contracts list (impact's media aside, a public operational field), plus a steward-note pattern. No key in the committed snapshot or the seed files matches the new names. The test model now expects workflow fields (reviewedBy and the like) to be stripped rather than quarantined, keeps media and media.reviewStatus as public operational names, and gives each property a 60 s limit so a loaded machine cannot fail it on time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Model: claude-opus-5-5/high
…key normalizer From the adversarial review of PR 85 at 3112d44 (all non-blocking): - the nested property also plants private fields inside arrays of objects (links, stewards, proof signals, public members), and asserts that themes is the only collection with nothing nested rather than skipping silently - the extras property checks that published key order matches the record's - the duplicate key normalizer is gone; the comment on the known private names says generic ones fail closed and raise the quarantine alert Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Model: claude-opus-5-5/high
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 503620d1ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…fore the pick From Codex on PR 85: toPublicOperationalLocations accepts latitude and longitude aliases, but the pick removed them before the locations were built, so such a chapter would have left /locations.json. Locations and impact bindings build explicit payloads, so they now read the records that passed the quarantine check; the published chapter still carries only its listed fields. A test covers the alias case and fails without this change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Model: claude-opus-5-5/high
CI typecheck at b52f8c9: seo on a Record<string, unknown> is unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Model: claude-opus-5-5/high
Why
Plan item 20: "no payload type can carry email, raw note, pending submission". Map nodes, map state and the impact payload already build their output field by field. Operational records did not:
PublicOperationalRecordwas{ slug; id; [key: string]: any }, andnormalizeRecordspread every field its source carried. Only a denylist (containsPrivateOperationalContentField) stood between a new Directus column and the public site.Measured
PUBLIC_OPERATIONAL_RECORD_FIELDSinpackages/shared/src/public-content.tslists each collection's top-level public fields. Each list equals the keys the latestcontent.public_*view emits, the seed files carry and the committed snapshot holds. Chapters also readimageAlt,imageCreditandimageFileId, which the image resolver consumes.PublicChapterRecordand the rest;PublicOperationalRecordis their union). An unlisted field does not type-check. Nested values stay under the existing denylist scan and quarantine.scripts/public-projection-allowlist.test.ts(fast-check, 300 runs per property):PUBLIC_MAP_NODE_FIELDS, with no private field or value. Pending, rejected, archived, blank and missing statuses are never published.@ts-expect-errorlines prove that an email, raw note, pending revision or review note does not fit the public types. If the types ever regain an index signature, the typecheck fails.fast-check4.10.3 (and its one dependency,pure-rand8.4.2) added as an exact root devDependency through the release-age gate, approved by afo in the session.Verification
Tier: critical (
packages/shared/src/public-content.ts) and agent image (packages/shared/src/**,package.json,bun.lock): merges only on afo's go, pinned to the head. Head:f7cc40d4cd4c8285f5056ebcab90a1069b37a35c.Full gate green at the head: PR checks (typecheck including the
@ts-expect-errortype test, lint, every test file, website build, size budget), Database proofs, em dashes, supply chain, agents doctor, CodeQL. Rendered proof does not apply: the snapshot content is unchanged (the committed-snapshot round trip passes), so no page renders differently.The first CI run (31f2f20) failed, which was useful: the properties found private values that the old denylist let through when nested inside a published object (
featuredStory.request_ip,media.request_metadata,media.consumed_at,impactSources.mediaUrls,cadence.works). 3112d44 makes the operational scan match the map-node and impact private names exactly. Against the old scan, the nested properties fail for every collection with object values; with the fix, all 17 properties pass locally (bun test scripts/public-projection-allowlist.test.ts) and in CI.No key in the committed snapshot or the seed files matches the new private names, so no current record is newly quarantined.
bun test scripts/public-content-contract.test.ts scripts/map-node-contract.test.ts: 139 pass.Fresh adversarial review of 3112d44: approve. It confirmed the lists equal the views' keys, nothing the website or locations or impact bindings read is dropped, the type test is type-checked, and the lockfile adds only fast-check and pure-rand within the release-age gate (fast-check published 2026-11-18, about 3.5 days before the commit). Its non-blocking notes are addressed in 503620d (arrays of objects fuzzed, key order asserted, one key normalizer, a comment on generic names failing closed), which a second fresh review approved.
After afo's first go (at 503620d), Codex found that the pick dropped the
latitude/longitudealiases before map locations were built. b52f8c9 builds locations and impact bindings from the checked records before the pick, with a test that fails without it; a fresh review approved b52f8c9. f7cc40d only types that test's lookup (CI typecheck);bun run typecheckpasses locally, 18 properties pass, and the full gate is green at f7cc40d. The fast-check thread is answered with afo's approval quote.Not verified
🤖 Generated with Claude Code